import _ from "lodash";
import StringUtils from "../../util/StringUtils";

class WeaponSkillLoader {

    static getWeaponSkillMode(name: string | undefined): string | undefined {
        if (name === undefined) return undefined;
        let nameForUse = name;
        if (_.startsWith(nameForUse, "齐心★")) nameForUse = StringUtils.substringAfter(nameForUse, "齐心★");
        return WEAPON_SKILL_MAPPING[nameForUse];
    }

    static getWeaponSkillNames() {
        return Object.keys(WEAPON_SKILL_CODE_MAPPING);
    }

    static getWeaponSkillCode(name: string | undefined): string | undefined {
        if (name === undefined) return undefined;
        return WEAPON_SKILL_CODE_MAPPING[name];
    }

}

const WEAPON_SKILL_MAPPING: any = {
    "神枪 永恒": "spear",
    "霸邪斧 天煌": "axe",
    "魔刀 哭杀": "blade",
    "神器 苍穹": "crossbow",
    "魔神器 幻空": "shield",
    "真·圣剑 苍白的正义": "sword",
    "双经斩": "tomahawk",
    "1.5倍界王拳套": "unarmed",
    "九齿钉耙": "harrow",
    "降魔杖": "staff",
    "2015.02.14情人节巧克力": "pingtian-dafa",
    "2005.5.1-2006.5.1劳动升级版": "unarmed",
    "波斯弯刀": "blade",
    "女神之剑": "sword",
    "星夜之弓": "archery",
    "鲁恩之刀": "blade",
    "裂天矛": "lance",
    "沉默之剑": "sword",
    "破云弓": "archery",
    "光之剑": "sword",
    "巨魔弓 世界": "archery",
    "邪骇灵杖": "staff",
    "战魔刀": "blade",
    "闪刺枪": "spear",
    "妖枪 影": "spear",
    "传说之剑": "sword",
    "魔杖 霜雪": "staff",
    "生存之刀": "blade",
    "月牙型剑": "sword",
    "白金枪": "spear",
    "炙雷之斧": "axe",
    "圣纹剑": "sword",
    "铭刀长刀": "blade",
    "水晶刀": "blade",
    "圣枪 隆基诺斯": "spear",
    "飞凤枪": "spear",
    "雨之村云": "blade",
    "影忍者刀": "blade",
    "鸣雷剑": "sword",
    "铳剑": "sword",
    "刺馈剑": "sword",
    "双刃": "blade",
    "秘剑 天下": "sword",
    "赎罪镇魂剑": "sword",
    "虚空之枪": "spear",
    "封魔弓": "archery",
    "霸枪 龙息": "spear",
    "光阴之剑": "sword",
    "大马士革钢刀": "blade",
    "秘银长剑": "sword",
    "流星闪爪": "unarmed",
    "奥利哈钢剑": "sword",
    "月牙法杖": "staff",
    "冰之拳套": "unarmed",
    "鬼灵之弓": "archery",
    "邪双华": "sword",
    "震雷匕首": "unarmed",
    "财富之军刀": "blade",
    "空斩短刃": "blade",
    "白银弓": "archery",
    "圣杖 天问": "staff",
    "绿玉投枪": "spear",
    "世界树之枝": "staff",
    "精灵之弓矢": "archery",
    "夺魂冰钩": "rope",
    "圣使之刺剑": "sword",
    "秘刀 走雪": "blade",
    "血之剑": "sword",
    "寡妇制造器": "staff",
    "瓦谕剑": "sword",
    "封神剑 天劫": "sword",
    "奥利哈钢匕首": "unarmed",
};

const WEAPON_SKILL_CODE_MAPPING: any = {
    "基本剑术": "sword",
    "基本刀术": "blade",
    "基本枪术": "spear",
    "基本杖术": "staff",
    "基本斧术": "axe",
    "基本弓术": "archery",
    "基本搏击": "unarmed",
    "基本索术": "rope",
    "基本盾术": "shield",
    "基本钺术": "tomahawk",
    "基本矛术": "lance",
    "基本钯术": "harrow",
    "基本弩术": "crossbow",
};

export {WeaponSkillLoader};